package com.jcgyl.export.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.jcgyl.export.entity.PermissionsModel;
import com.jcgyl.export.entity.Tbsysmenu;
import com.jcgyl.export.service.PermissionsService;
import com.jcgyl.export.service.PostRoleService;
import com.jcgyl.export.util.entity.Result;
//权限
@RestController
@RequestMapping("/postRole")
public class PostRoleController {
	@Autowired
	private PostRoleService postRoleService;
	
	@PostMapping("/findRidByPid")
	public List<Integer>  doFindRidByPid(@RequestBody int pid) {
		//int pid =Integer.parseInt(pid);
		return postRoleService.findRoleIdByPid(pid);
	}  
	@PostMapping("/updateRid")
	public Result doUpdateRid(@RequestBody PermissionsModel permissionsModel ) {
		int pid=permissionsModel.getId();
		List<Integer> list=permissionsModel.getList();
		System.out.println(list);
		return postRoleService.updatePermissionsbyRoleId(pid, list);
	} 
}
